﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.ui.renderers {
    import reprise.commands.*;
    import reprise.utils.*;

    public class DefaultTooltipRenderer extends AbstractTooltip {

        protected var fadeIn:Delegate;
        protected var isFadingIn:Boolean;
        protected var isFadingOut:Boolean;
        protected var isVisible:Boolean;
        protected var fadeOut:Delegate;

        public static var className:String = "DefaultTooltipRenderer";

        protected function doShow(... _args):void{
            opacity = (opacity + 0.4);
            if (opacity >= 1){
                FrameCommandExecutor.instance().removeCommand(fadeIn);
                isFadingIn = false;
                isVisible = true;
                show_complete();
            };
        }
        override public function hide(... _args):void{
            if (((isFadingOut) || (((!(isVisible)) && (!(isFadingIn)))))){
                return;
            };
            isFadingIn = false;
            isFadingOut = true;
            FrameCommandExecutor.instance().removeCommand(fadeIn);
            FrameCommandExecutor.instance().addCommand(fadeOut);
        }
        protected function doHide(... _args):void{
            opacity = (opacity - 0.4);
            if (opacity <= 0){
                FrameCommandExecutor.instance().removeCommand(fadeOut);
                isFadingOut = false;
                isVisible = false;
                hide_complete();
            };
        }
        override public function show(... _args):void{
            if (((isFadingIn) || (((isVisible) && (!(isFadingOut)))))){
                return;
            };
            setVisibility(true);
            isFadingOut = false;
            isFadingIn = true;
            FrameCommandExecutor.instance().removeCommand(fadeOut);
            FrameCommandExecutor.instance().addCommand(fadeIn);
        }
        override protected function initialize():void{
            super.initialize();
            fadeIn = new Delegate(this, doShow);
            fadeOut = new Delegate(this, doHide);
            isFadingIn = false;
            isFadingOut = false;
            isVisible = false;
            alpha = 0;
        }

    }
}//package reprise.ui.renderers 
